/*
 * Logger.h
 *
 *  Created on: Nov 7, 2010
 *      Author: ezbe
 */

#ifndef LOGGER_H_
#define LOGGER_H_

//includes
#include <string>
#include <assert.h>

class ILogger
{
public:

	enum LOG_FILTERLEVELS
	{
		LOG_DEBUG = 0,		//Debug-messages, for developers
		LOG_INFO,			//General information, subsystem this and that went up etc.
		LOG_WARN,			//Warning, non-fatal but unexpected state or such, might affect current operation
		LOG_ERROR,			//Something is definitely wrong, some operation cannot be completed at all etc, possibly fatal
		LOG_CRITICAL		//Something is so badly wrong that the system needs to be taken down, usually you should jump
							//to shutting down after displaying a critical log message. (throw Exception)
	};

	ILogger() {}

	virtual ~ILogger() {}

	virtual void setFilterLevel(LOG_FILTERLEVELS level) { m_filterLevel = level; }

	/**
	 * Write the message to log at LOG_DEBUG -level, if it isn't filtered out
	 * @param msg	Message to write
	 */
	virtual void debug(std::string msg) = 0;

	/**
	 * Write the message to log at LOG_INFO -level, if it isn't filtered out
	 * @param msg	Message to write
	 */
	virtual void info(std::string msg) = 0;

	/**
	 * Write the message to log at LOG_WARN -level, if it isn't filtered out
	 * @param msg	Message to write
	 */
	virtual void warn(std::string msg) = 0;

	/**
	 * Write the message to log at LOG_ERROR -level, if it isn't filtered out
	 * @param msg	Message to write
	 */
	virtual void error(std::string msg) = 0;

	/**
	 * Write the message to log at LOG_CRITICAL -level, if it isn't filtered out
	 * @param msg	Message to write
	 */
	virtual void critical(std::string msg) = 0;

	/**
	 * Write the message to log as "System message", NEVER FILTER THESE
	 * @param msg	Message to write
	 */
	virtual void system(std::string msg) = 0;

protected:

	LOG_FILTERLEVELS m_filterLevel;

};

#endif /* LOGGER_H_ */
